<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/include.jsp"%>
<%@ page import="com.ekingstar.framework.security.UserUtil"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>ekingstar 后勤系统</title>
<style type="text/css">
body{background:url(images/login_bg.jpg) repeat-x top #B9D0FF; text-align:center; margin:0px;font-size:12px;}
div{ margin:0 auto;}
.login{background:url(images/login.jpg) no-repeat; width:808px; height:610px;}
.table {padding-top:480px; margin:0 auto;}
.table .text{ font-weight:bold; color:#003E8B; text-align:right;}
.loginInput{ border:1px solid #A0C5E5; background:#F4F4F4; height:16px;}
.loginBotton{ background:#003E8B; background:url(images/login_btn.jpg) no-repeat; color:#003E8B;font-weight:bold; border:0px; width:60px; height:28px}
.copyright{ font-family:Arial, Helvetica, sans-serif; padding-top:40px;}
a.msg:link,a.msg:visited{ text-decoration:none; color:#333;}
a.msg:hover{ text-decoration: underline; color:#f00;}
.error{padding-top:4px; color:red; width:95%;}
</style>
</head>
<body>
<div class="login">
  <%
		boolean logged = UserUtil.isLogged();
		String  de = request.getParameter("displayError");
		boolean isDisplayError = true;
		if (de != null && "no".equals(de.trim())){
		 isDisplayError= false;
		}
		if (!logged){
	%>
  <table width="90%" border="0" cellspacing="0" cellpadding="0" class="table">	
	<form action='<s:url value="/j_acegi_cas_security_check"/>' method='post'>
    <tr>
        <td class="text">用户名：</td>
        <td align="left"><input type='text' class="loginInput" name='j_username' value="<s:property value='#session.SPRING_SECURITY_LAST_USERNAME'/>"></td>
    	<td align="right" class="text">密码：</td>
        <td align="left"><input type='password' class="loginInput" name='j_password'/></td>
    	<td align="left"><input type="submit" name="btn_submit" value="登录" class="loginBotton" /></td>
    </tr>   
    </form>
  	</table>  	
  	<%if (isDisplayError) {%>
	<div>
		<s:if test="#session.SPRING_SECURITY_LAST_EXCEPTION instanceof org.springframework.security.concurrent.ConcurrentLoginException">
		<div class="error">友情提示：<s:property value="#session.SPRING_SECURITY_LAST_USERNAME"/>已在别处登陆</div>
		</s:if>
		<s:elseif test="#session.SPRING_SECURITY_LAST_EXCEPTION instanceof com.ekingstar.framework.service.PwdErrorAuthenticationException">
			<div class="error">友情提示：${SPRING_SECURITY_LAST_EXCEPTION.message}</div>
		</s:elseif>	
		<s:elseif test="#session.SPRING_SECURITY_LAST_EXCEPTION instanceof org.springframework.security.AuthenticationException">
			<div class="error">友情提示：用户名或密码不正确</div>
		</s:elseif>
		<s:elseif test="#session.SPRING_SECURITY_LAST_EXCEPTION != null">
			<div class="error">友情提示：${SPRING_SECURITY_LAST_EXCEPTION.message}</div>
		</s:elseif>
	</div>
	<%} %>
	<%} else {%>
		欢迎你.
	<%}%>
	<div class="copyright">版权所有2010&copy;ekingstar 高校决策支持系统</div>
</div>
</body>

</html>